<style>
	.layui-form input{
		width:400px;
	}
	.layui-layer-content{
		background: #040d33;
		color: white;
		font-size: 16px;
	}
	
	.layui-form-label{
		width: 90px;
	}
</style>
<div style="margin: 20px;">
	  <table class="n-tb">
	    <thead>
	      <tr>
	        <th>NAME</th>
	        <th>Email</th>
	        <th>Research Interests</th>
	        <th>Personal page</th>
	        <th>Registration time</th>
	        <th>FILES</th>
	        <th>STATUS</th>
	        <th>CONTROLS</th>
	      </tr> 
	    </thead>
	    <tbody>
		     <#if users??>
		    	<#list users as user>
		    	 <tr>
			        <td>${user.user_name!}</td>
			        <td>${user.user_email!}</td>
			        <td>${user.user_interests!}</td>
			        <td>${user.user_page!}</td>
			        <td>${user.user_regtime!}</td>
			        <td>
			        	<#if userfs??>
			        		<#assign flag = true>
			        		<#list userfs as f >
			        			<#if user.user_email == f.user_id>
			        				<#assign flag = false>
			        				<p><a style="color: #e39e9e" href='/api/downUserFiles/${f.file_id!}'>${f.file_realname!}</p>
			        			</#if>
			        		</#list>
			        		<#if flag>
			        			<p>NO FILE</p>
			        		</#if>
			        	<#else>
			        		-
			        	</#if>
			        </td>
			        <!-- 0 暂未审核 2 被锁定  1激活状态-->
			        <#if user.user_status == '0'>
			        	<td>UNREVIEWED</td>
			        	<td><font onclick="rbac('${user.user_id!}','1',this);" style="cursor: pointer;">AUDIT</font></td>
			        </#if>
			        <#if user.user_status == '1'>
			        	<td>ACTIVATED</td>
			        	<td><font onclick="rbac('${user.user_id!}','2',this);" style="cursor: pointer;">LOCK</font></td>
			        </#if>
			        <#if user.user_status == '2'>
			        	<td>LOCKED</td>
			        	<td><font onclick="rbac('${user.user_id!}','1',this);" style="cursor: pointer;">ACTIVAT</font></td>
			        </#if>
			      </tr>
		    	</#list>
		    </#if>
	    </tbody>
	  </table>
	</div>
<script>
	function rbac(id,toS,obj){
		var config ={ url:"/api/active",
				  data:{
					  u:id,
					  s:toS,
				  },
				  callBackFunc:function(res){
					  if(res){
						  layer.msg("Controls successfully !");
						  if(toS == '0'){//暂未审核
							  $(obj).parent().prev().text("ACTIVATED");
							  $(obj).parent().html('<font onclick="rbac(\''+id+'\',\''+2+'\',this);" style="cursor: pointer;">LOCK</font>');
						  }else if(toS == '1'){//激活状态
							  $(obj).parent().prev().text("ACTIVATED");
							  $(obj).parent().html('<font onclick="rbac(\''+id+'\',\''+2+'\',this);" style="cursor: pointer;">LOCK</font>');
						  }else{// 被锁定
							  $(obj).parent().prev().text("lOCKED");
							  $(obj).parent().html('<font onclick="rbac(\''+id+'\',\''+1+'\',this);" style="cursor: pointer;">ACTIVAT</font>');
						  }
					  }else{
						  layer.msg("Controls error !");
					  }
				  }
				};
		HD.doPost(config);
	}
	$(function(){
		$("#layform").niceScroll({
		    cursorwidth:"0px",
		    railpadding:{top:'20',right:'0',left:'0',bottom:'0'}
		}); 
	})
</script>